package com.zhentao.controller;

import com.zhentao.model.common.app.dto.CommentDeleteDto;
import com.zhentao.model.common.app.dto.CommentFindAllDto;
import com.zhentao.model.common.app.pojo.Comment;
import com.zhentao.model.common.dtos.ResponseResult;
import com.zhentao.service.ApCommentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/app/comment")
@Api(tags = "app端：评论表接口")
public class ApCommentController {
    @Autowired
    private ApCommentService apCommentService;


    /**
     * app端：评论表查询所有
     * @return
     */
    @PostMapping("/commentFindAll")
    @ApiOperation("评论查询")
    public ResponseResult commentFindAll(@RequestBody CommentFindAllDto dto){
        return apCommentService.commentFindAll(dto);
    }


    /**
     * app端：添加朋友圈
     * @param comment
     * @return
     */
    @PostMapping("/saveCommnet")
    @ApiOperation("进行评论操作")
    public ResponseResult saveCommnet(@RequestBody Comment comment){
        return apCommentService.saveCommnet(comment);
    }


    /**
     * app端：删除评论
     * @param dto
     * @return
     */
    @PostMapping("/deleteComment")
    @ApiOperation("删除评论")
    public ResponseResult deleteComment(@RequestBody CommentDeleteDto dto){
        return apCommentService.deleteComment(dto);
    }
}
